package com.jinxin.platform.cdfaceacs.service.impl;

import com.jinxin.platform.cdfaceacs.mapper.JurenAcsControlUserDeviceInfoDao;
import com.jinxin.platform.cdfaceacs.pojo.domains.AcsControlUserDeviceInfo;
import com.jinxin.platform.cdfaceacs.service.AcsControlUserDeviceInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (AcsControlUserDeviceInfo)表服务实现类
 *
 * @author cyl
 * @since 2020-04-17 17:14:51
 */
@Service("acsControlUserDeviceInfoService")
public class AcsControlUserDeviceInfoServiceImpl implements AcsControlUserDeviceInfoService {
    @Resource
    private JurenAcsControlUserDeviceInfoDao jurenAcsControlUserDeviceInfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public AcsControlUserDeviceInfo queryById(String id) {
        return this.jurenAcsControlUserDeviceInfoDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<AcsControlUserDeviceInfo> queryAllByLimit(int offset, int limit) {
        return this.jurenAcsControlUserDeviceInfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param acsControlUserDeviceInfo 实例对象
     * @return 实例对象
     */
    @Override
    public AcsControlUserDeviceInfo insert(AcsControlUserDeviceInfo acsControlUserDeviceInfo) {
        this.jurenAcsControlUserDeviceInfoDao.insert(acsControlUserDeviceInfo);
        return acsControlUserDeviceInfo;
    }

    /**
     * 修改数据
     *
     * @param acsControlUserDeviceInfo 实例对象
     * @return 实例对象
     */
    @Override
    public AcsControlUserDeviceInfo update(AcsControlUserDeviceInfo acsControlUserDeviceInfo) {
        this.jurenAcsControlUserDeviceInfoDao.update(acsControlUserDeviceInfo);
        return this.queryById(acsControlUserDeviceInfo.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(String id) {
        return this.jurenAcsControlUserDeviceInfoDao.deleteById(id) > 0;
    }
}